package com.handle.system.svc.convert;

import com.handle.system.api.dto.OauthClientDetailsDto;
import com.handle.system.api.dto.SysTenantDto;
import com.handle.system.api.entity.OauthClientDetails;
import com.handle.system.api.entity.SysTenant;
import org.mapstruct.IterableMapping;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author zhangqing
 * @description 对象转换
 */
@Mapper(componentModel = "spring")
public interface BeanCovert {

    BeanCovert INSTANCE = Mappers.getMapper(BeanCovert.class);

    /**
     * list转换
     *
     * @param sysTenants 实体类
     * @return dto
     */
    @IterableMapping(elementTargetType = SysTenantDto.class)
    List<SysTenantDto> toTenantConvertDTOList(List<SysTenant> sysTenants);

    /**
     * list转换
     *
     * @param oauthClientDetails 实体类
     * @return dto
     */
    @IterableMapping(elementTargetType = OauthClientDetailsDto.class)
    List<OauthClientDetailsDto> toConvertDTOList(List<OauthClientDetails> oauthClientDetails);

    /**
     * oauthClientDetails实体转dto
     *
     * @param oauthClientDetails 实体
     * @return dto
     */
    @IterableMapping(elementTargetType = OauthClientDetailsDto.class)
    OauthClientDetailsDto toConvertDTO(OauthClientDetails oauthClientDetails);
}
